package com.vic.test.aspect;

import java.lang.reflect.Method;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vic.framework.annotation.Aspect;
import com.vic.framework.annotation.Controller;
import com.vic.framework.proxy.AspectProxy;

/**
 * 拦截Controller方法
 * @author VIC
 *
 */
//@Aspect(Controller.class)
public class AspectController extends AspectProxy{

	private static final Logger logger = LoggerFactory.getLogger(AspectController.class);

	private long begin;
	@Override
	public void before(Class<?> cls, Method method, Object[] params) throws Throwable {
		logger.debug("----------begin----------");
		logger.debug(String.format("class: %s", cls.getName()));
		logger.debug("method:{}", method.getName());
		
		begin = System.currentTimeMillis();
	}

	@Override
	public void after(Class<?> cls, Method method, Object[] params) throws Throwable {
		logger.debug("time: {}", (System.currentTimeMillis() - begin));
		logger.debug("------------end---------------");
	}
	
	

}
